import { alova } from '../../request';

/** get configCategory page */
export function paginateConfigCategory(params?: Api.SearchParams) {
  return alova.Get<Api.PageRow>('/setting/configCategory/paginate', {
    params
  });
}

export function createConfigCategory(data?: Api.Model) {
  return alova.Post<boolean>('/setting/configCategory/create', data);
}

export function updateConfigCategory(data?: Api.Model) {
  return alova.Post<boolean>('/setting/configCategory/update', data);
}

/** get all config category */
export function listConfigCategory() {
  return alova.Get<Api.Row[]>('/setting/configCategory/list');
}

export function deleteConfigCategory(id: number) {
  return alova.Post<boolean>('/setting/configCategory/delete', { id });
}

export function batchDeleteConfigCategory(ids: number[]) {
  return alova.Post<boolean>('/setting/configCategory/batchDel', { ids });
}

/** get config paginate */
export function paginateConfig(params?: Api.SearchParams) {
  return alova.Get<Api.Manage.ConfigList>('/setting/config/paginate', {
    params
  });
}

export function createConfig(data?: Api.Model) {
  return alova.Post<boolean>('/setting/config/create', data);
}

export function updateConfig(data?: Api.Model) {
  return alova.Post<boolean>('/setting/config/update', data);
}

/** get all configs */
export function listConfig() {
  return alova.Get<Api.Row[]>('/setting/config/list');
}

export function deleteConfig(id: number) {
  return alova.Post<boolean>('/setting/config/delete', { id });
}

export function batchDeleteConfig(ids: number[]) {
  return alova.Post<boolean>('/setting/config/batchDel', { ids });
}
